We can set the map extent by centering the map on our data and increasing the zoom level.
- Note:
get_map prints a lot of messages to the screen!
# Get the center point of the data
sf_ctr <- c(lon = mean(sfhomes$lon), lat = mean(sfhomes$lat))
sf_ctr # take a look
# create the map - setting the zoom level to 12
sf_basemap <- get_map(sf_ctr, source="stamen",
maptype="toner-lite", zoom=12)
## Source : https://maps.googleapis.com/maps/api/staticmap?center=37.758403,-122.439444&zoom=12&size=640x640&scale=2&maptype=terrain&key=xxx
## Source : http://tile.stamen.com/toner-lite/12/653/1582.png
## Source : http://tile.stamen.com/toner-lite/12/654/1582.png
## Source : http://tile.stamen.com/toner-lite/12/655/1582.png
## Source : http://tile.stamen.com/toner-lite/12/656/1582.png
## Source : http://tile.stamen.com/toner-lite/12/653/1583.png
## Source : http://tile.stamen.com/toner-lite/12/654/1583.png
## Source : http://tile.stamen.com/toner-lite/12/655/1583.png
## Source : http://tile.stamen.com/toner-lite/12/656/1583.png
## Source : http://tile.stamen.com/toner-lite/12/653/1584.png
## Source : http://tile.stamen.com/toner-lite/12/654/1584.png
## Source : http://tile.stamen.com/toner-lite/12/655/1584.png
## Source : http://tile.stamen.com/toner-lite/12/656/1584.png